package service.impl;

import dao.ICompanyDao;
import dao.Impl.CompanyImpl;
import dao.Impl.NavImpl;
import dao.NavDao;
import dto.CommonModelDto;
import dto.CompanyModelDto;
import model.CompanyModel;
import model.NavModel;
import service.ICommonService;

import java.util.List;

public class CommonServiceImpl implements ICommonService {

    public  CommonServiceImpl(){
//        ICompanyDao iCompanyDao = new CompanyImpl();
//        CompanyModel companyModel = new CompanyModel();
//        iCompanyDao.addCompany(companyModel);
    }

    /**
     * 封装公共的信息
     * @return
     */
    @Override
    public CommonModelDto getCommonModelDto() {
//        ICompanyDao dao = new CompanyImpl();
        CommonModelDto commonModelDto= new CommonModelDto();
        commonModelDto.setCompanyModel(getCompanyModel());
        commonModelDto.setNavList(getNavList());
        return commonModelDto;
    }

    @Override
    public int add(CompanyModel companyModel) {
        return 0;
    }

    /**
     * 得到公司信息
     * @return
     */
    private CompanyModelDto getCompanyModel(){
         ICompanyDao iCompanyDao= new CompanyImpl();
        return  iCompanyDao.getCommonModelDto();
     }
     private List<NavModel> getNavList(){
         NavDao dao =new NavImpl();
        return dao.getNavModelList();
     }
}
